home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / DA / P / Pica Calculator 2 / PC2 Folder / PC2 Sample Pgms / PC2 Sample Pgms.rsrc / pPGM_18478_Linear Regression < prev    next >
Encoding:
Text File  |  1993-07-16  |  1.0 KB  |  182 lines

  1. ! Linear Regression
  2. ! © 1993 by
  3. ! Jim Lewis
  4. Z
  5. #0
  6. ◊MeanX
  7. r3
  8. /
  9. r0
  10. =
  11. ^
  12. ◊MeanY
  13. r1
  14. /
  15. r0
  16. =
  17. ^
  18. ◊DataEntry
  19. »Entry Loop
  20. ?Next X data? (0=END, -x=DEL)
  21. <
  22. GDelData
  23. GEndData
  24. s6
  25. ∑3
  26. x
  27. ∑4
  28. r0
  29. ?Corresponding Y data?
  30. §6
  31. ∑1
  32. x
  33. ∑2
  34. #0
  35. ™6
  36. ∑5
  37. #1
  38. ∑0
  39. r0
  40. GEntry Loop
  41. »DelData
  42. ª
  43. s6
  44. –3
  45. x
  46. –4
  47. ?Corresponding -Y data?
  48. ª
  49. §6
  50. –1
  51. x
  52. –2
  53. #0
  54. ™6
  55. –5
  56. #1
  57. –0
  58. r0
  59. GEntry Loop
  60. »EndData
  61. r0
  62. ^
  63. !Compute Std.Dev
  64. ◊StdDevX
  65. ƒMeanX
  66. r4
  67. GDoDeviation
  68. ^
  69. ◊StdDevY
  70. ƒMeanY
  71. r2
  72. »DoDeviation
  73. -
  74. (
  75. r0
  76. *
  77. #0
  78. x
  79. )
  80. =
  81. /
  82. r0
  83. =
  84. ^
  85. ◊Slope
  86. r5
  87. /
  88. r0
  89. -
  90. ƒMeanY
  91. *
  92. ƒMeanX
  93. =
  94. /
  95. ƒStdDevX
  96. =
  97. ^
  98. ◊yIntercept
  99. ƒSlope
  100. *
  101. ƒMeanX
  102. ±
  103. +
  104. ƒMeanY
  105. =
  106. ^
  107. ◊Findr
  108. ƒSlope
  109. x
  110. /
  111. ƒStdDevY
  112. *
  113. ƒStdDevX
  114. =
  115. ^
  116. ◊xEqualsy
  117. ?Enter X value:
  118. s7
  119. ƒSlope
  120. §7
  121. ƒyIntercept
  122. ∑7
  123. r7
  124. ^
  125. ◊yEqualsx
  126. ?Enter Y value:
  127. s7
  128. ƒyIntercept
  129. –7
  130. ƒSlope
  131. ÷7
  132. r7
  133. ^
  134. !Main Program
  135. #0
  136. ƒDataEntry
  137. GNoData
  138. ƒSlope
  139. @The slope is:
  140. ƒyIntercept
  141. @The y intercept is:
  142. ƒFindr
  143. @Correlation factor:
  144. »MainLoop
  145. #1
  146. ?(1=Find X, 2=Find Y, 0=END):
  147. GdoFindx
  148. #2
  149. GdoFindy
  150. #0
  151. GNoData
  152. GMainLoop
  153. »doFindx
  154. ƒxEqualsy
  155. @Y intercept:
  156. GMainLoop
  157. »doFindy
  158. ƒyEqualsx
  159. @X intercept:
  160. GMainLoop
  161. »NoData
  162. ~
  163.